using System.Data.Entity.ModelConfiguration;
using ExampleWebApplication.Entities;

namespace ExampleWebApplication.Infraestruture.EntityFramework.EntityTypeConfigurations
{
    public class OrderConfiguration : EntityTypeConfiguration<Order>
    {
        public OrderConfiguration()
        {
            HasRequired(x => x.Customer).WithMany(x => x.Orders).Map(m => m.MapKey("CustomerID"));

            HasRequired(x => x.Shipper).WithMany(x => x.Orders).Map(m => m.MapKey("ShipVia"));
            
            HasRequired(x => x.Employee).WithMany(x => x.Orders).Map(m => m.MapKey("EmployeeID"));
        }
    }
}